{% extends "admin/base.html" %}
{% block title %} 标签管理 {% endblock %}
{% block menu %}
    {% set menu_current = 'tag' %}
    {% include 'admin/menu.html' %}
{% endblock %}
{% block content %}
    <div id="where">当前位置：<span class="chosen">标签管理</span></div>
    <div id="tag" class="content">
        <h3>所有标签</h3>
        <div class="data-list">
            <form method="post" action="../tag_del/?next={{url}}">             
            <table cellspacing="0">
            <thead>
                <tr>
                    <th><label><input type="checkbox" name="select_all" /></label></th>
                    <th style="width:200px;">标签名</th>
                    <th>文章数量</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            {% if tags %}
                {% for i in tags %}
                <tr class="{{ loop.cycle('odd', 'even') }}">
                    <td><input type="checkbox" name="ids" value="{{ i.id }}" /></td>
                    <td><a href="entry/tag/{{i.id}}" title="">{{ i.title }}</a></td>
                    <td>{{ i.entries|count }}</td>
                    <td><a url="tag/{{ i.id }}/del" href="javascript:;" class="del">删除</a></td>
                </tr>
                {% endfor %}
            {% else %}
                <tr>
                    <td colspan="4"><p class="no-data">暂无记录</p></td>
                </tr>
            {% endif %}
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="4"><input type="submit" class="button" value="批量删除" /></td>
                </tr>
            </tfoot>
            </table>
            </form>
        </div>


    </div>
{% endblock %}
{% block js %}
    <script language="JavaScript" type="text/javascript">
    <!--
    $(function(){
        $('a.del').click(function(){
            var url = $(this).attr('url');
            var r=confirm("确定要删除吗？");
            if (r==true) {
                location.href = url;
            }	
        })
        $('input[name=select_all]').click(function(){
            if ($(this).attr('checked')==true)
            {
                $(this).parents('table').find('input[type=checkbox]').attr('checked','checked');
            } else {
                $(this).parents('table').find('input[type=checkbox]').removeAttr('checked');
            }
        })
    })
    //-->
    </script>
{% endblock %}